# coding: utf-8
import os


class Config(object):
    """配置基类"""
    # Flask app config
    DEBUG = True
    TESTING = False
    SECRET_KEY = "\xb5\xb3}#\xb7A\xcac\x9d0\xb6\x0f\x80z\x97\x00\x1e\xc0\xb8+\xe9)\xf0}"
    PERMANENT_SESSION_LIFETIME = 3600 * 24 * 7
    SESSION_COOKIE_NAME = 'ahs_session'

    # Site domain
    SITE_DOMAIN = "http://weiyundata.pypyhc.com"

    # SQLAlchemy config
    # See:0

    # https://pythonhosted.org/Flask-SQLAlchemy/config.html#connection-uri-format
    # http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls
    SQLALCHEMY_DATABASE_URI = "mysql://root:root@localhost/shechipin"
    PRODUCT_URL = SITE_DOMAIN + "/static/upload/products/"
    IMAGE_URL = SITE_DOMAIN + "/static/img/"

    # Redis
    REDIS = True  # 是否启用Redis
    REDIS_HOST = "localhost"
    REDIS_PORT = 6379
    REDIS_DB = 1

    # Root path of project
    PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

    # Uploadsets config
    UPLOADS_DEFAULT_DEST = os.path.join(PROJECT_PATH, 'web/static/upload')  # 上传文件存储路径

    XLS_PATH = os.path.join(PROJECT_PATH, 'web/static/xls')

    # UPLOADS_DEFAULT_URL = ""  # 上传文件访问URL

    UPLOADS_DEFAULT_URL = "static"  # 上传文件访问URL


    # AJAX 请求间隔时间
    AJAX_REQUEST_DELAY = 5000

    # wechat config
    WECHAT_APPID = "wx6ba2410bf0ece7b2"
    WECHAT_APPSECRET = "1d065129e62172df3e6c3310435f18a2"

    WEIXIN_NOTIFY_URL = "http://weiyundata.pypyhc.com"


    # Host string, used by fabric
    HOST_STRING = "root@120.25.145.142"

    DEVICES = [
        ('mobile',
         'iPhone|iPod|Android.*Mobile|Windows.*Phone|dream|blackberry|CUPCAKE|webOS|incognito'
         '|webmate'),
        ('tablet', 'iPad|Android'),
        ('pc', '.*')
    ]
